<% get_restaurant_sidebar('order') %>
<% get_restaurant_breadcrumb(@navs,@nav_title) %>

<div class="row">
  <div class="col-md-12">
    <div class="white-box">
      <%= link_to("重新打印订单", "/restaurants/orders/#{@order.id}/print_order" , class:"btn btn-primary") %>
      <% if @order.status == Order::WAIT %>
        <%= link_to("取消订单", "/restaurants/orders/#{@order.id}/cancel" , method: :delete,class:"btn btn-danger pull-right",data:{confirm:"确定要取消该订单吗?"} ) %>
      <% end %>
      <% if !@order.is_pay && @order.status != Order::CANCEL  %>
          <%= link_to("确认订单支付", "/restaurants/orders/#{@order.id}/pay" , class:"btn btn-info",data:{confirm:"确定该订单已支付吗?"},method: :get) %>
      <% end %>
      <% if @order.status == Order::SUCCESS  %>
        <%= link_to("确认订单已完成", "/restaurants/orders/#{@order.id}/finish_order" , class:"btn btn-info") %>
      <% end %>
    </div>
  </div>
</div>

<div class="row">
  <div class="col-md-12">
    <div class="panel panel-default">
     <div class="panel-heading">订单状态: 
        <span class="label <%= order_label @order %>"><%= @order.label %></span>
      </div>
      <div class="panel-wrapper collapse in">
       <div class="panel-body">
          <div class="table-responsive">
              <table class="table table-striped" >
                <thead>
                  <tr>
                    <th>菜品名</th>
                    <th>数量</th>
                    <th>单价</th>
                    <th>小计</th>
                  </tr>
                </thead>
                <tbody>
                  <%  @order.order_items.each do |item| %>
                    <%= render :partial => "order_item",:locals => {item: item} %>
                  <% end %>
                </tbody>
              </table>
          </div>
       </div>
       <div class="panel-footer">
         <div class="well text-right">
           总共<span style="color: #27AE60"><%= @order.total_quantity %></span>份菜
           总计<span style="color: #27AE60"><%= @order.total_price %></span>元
         </div>
       </div>
      </div>
    </div>  
  </div>        
</div>